package com.espirit.eap.manager;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.ManyToOne;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

import com.espirit.EntityMapping;
import com.espirit.eap.ICheckModelDuplicateInfo;
import com.googlecode.cswish.model.Saas;

@Entity
@com.espirit.eap.annotation.DomainModel
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class ProofNbrRule extends EntityMapping implements ICheckModelDuplicateInfo, Saas {

	private String name;
	private String modelName;
	private String prefix;
	private NbrRuleSource prefix1; //
	private NbrRuleSource prefix2;
	private NbrRuleSource prefix3;
	
	private NbrRuleSource prefix4;
	private NbrRuleSource prefix5;
	private NbrRuleSource prefix6;
	private NbrRuleSource prefix7;
	private NbrRuleSource prefix8;
	
	private Integer nextNbr;
	private Integer digit;
	
	public ProofNbrRule() {
	}
	
	public ProofNbrRule(String name ,String clazz  ,String prefix ,Integer digit) {
		this.prefix = prefix;
		this.digit = digit;
		this.name = name;
		this.modelName = clazz;
	}
	
	private Integer sid;
	public Integer getSid() {
		return sid;
	}

	public void setSid(Integer sid) {
		this.sid = sid;
	}
	
	@ManyToOne(targetEntity=NbrRuleSource.class,fetch=FetchType.LAZY)
	public NbrRuleSource getPrefix1() {
		return prefix1;
	}
	public void setPrefix1(NbrRuleSource prefix1) {
		this.prefix1 = prefix1;
	}
	
	@ManyToOne(targetEntity=NbrRuleSource.class,fetch=FetchType.LAZY)
	public NbrRuleSource getPrefix2() {
		return prefix2;
	}
	public void setPrefix2(NbrRuleSource prefix2) {
		this.prefix2 = prefix2;
	}
	
	@ManyToOne(targetEntity=NbrRuleSource.class,fetch=FetchType.LAZY)
	public NbrRuleSource getPrefix3() {
		return prefix3;
	}
	public void setPrefix3(NbrRuleSource prefix3) {
		this.prefix3 = prefix3;
	}
	
	@ManyToOne(targetEntity=NbrRuleSource.class,fetch=FetchType.LAZY)
	public NbrRuleSource getPrefix4() {
		return prefix4;
	}
	public void setPrefix4(NbrRuleSource prefix4) {
		this.prefix4 = prefix4;
	}
	
	@ManyToOne(targetEntity=NbrRuleSource.class,fetch=FetchType.LAZY)
	public NbrRuleSource getPrefix5() {
		return prefix5;
	}
	public void setPrefix5(NbrRuleSource prefix5) {
		this.prefix5 = prefix5;
	}
	
	@ManyToOne(targetEntity=NbrRuleSource.class,fetch=FetchType.LAZY)
	public NbrRuleSource getPrefix6() {
		return prefix6;
	}
	public void setPrefix6(NbrRuleSource prefix6) {
		this.prefix6 = prefix6;
	}
	
	@ManyToOne(targetEntity=NbrRuleSource.class,fetch=FetchType.LAZY)
	public NbrRuleSource getPrefix7() {
		return prefix7;
	}
	public void setPrefix7(NbrRuleSource prefix7) {
		this.prefix7 = prefix7;
	}

	private final static String[] gatherProperties = new String[]{"name","prefix"};
	@Override
	public String[] gatherProperties() {
		return gatherProperties;
	}
	
	public String getPrefix() {
		return prefix;
	}

	public void setPrefix(String prefix) {
		this.prefix = prefix;
	}

	public Integer getNextNbr() {
		return nextNbr;
	}

	public void setNextNbr(Integer nextNbr) {
		this.nextNbr = nextNbr;
	}

	public Integer getDigit() {
		return digit;
	}

	public void setDigit(Integer digit) {
		this.digit = digit;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getModelName() {
		return modelName;
	}

	public void setModelName(String modelName) {
		this.modelName = modelName;
	}

	@ManyToOne(targetEntity=NbrRuleSource.class,fetch=FetchType.LAZY)
	public NbrRuleSource getPrefix8() {
		return prefix8;
	}

	public void setPrefix8(NbrRuleSource prefix8) {
		this.prefix8 = prefix8;
	}
	
}
